//
//  AboutUsViewController.m
//  DaDaBao
//
//  Created by user on 15/8/23.
//  Copyright (c) 2015年 User. All rights reserved.
//

#import "AboutUsViewController.h"

@interface AboutUsViewController ()

@end

@implementation AboutUsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor hexStringToColor:@"#ebebeb"];
    [self createTheNavigationBar];
    
    NSString * detailString = @"大大宝是大大集团旗下专为白领打造的创新型互联网金融服务平台，由大大集团旗下子公司——上海申彤鱼鱼信息科技有限公司研发上线。大大宝结合大大集团自身产品研发优势及严格的风控体系，致力于为国内一流企业员工提供低门槛、高收益的投资产品。";
    CGFloat height = [UILabel height:detailString widthOfFatherView:SCREEN_WIDTH - 20 textFont:[UIFont systemFontOfSize:17]];
    
    UIView * aboutView = [[UIView alloc]initWithFrame:CGRectMake(0,64+10, SCREEN_WIDTH, 60+height)];
    aboutView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:aboutView];
    
    UILabel * tipLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 100, 40)];
    tipLabel.text = @"关于大大宝";
    [aboutView addSubview:tipLabel];
    
    UILabel * detailLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 40, SCREEN_WIDTH - 20, height)];
    detailLabel.numberOfLines = 0;
    detailLabel.text = detailString;
    detailLabel.lineBreakMode = NSLineBreakByWordWrapping;
    detailLabel.textColor = [UIColor grayColor];
    [aboutView addSubview:detailLabel];
    
    UIView * versionView = [[UIView alloc]initWithFrame:CGRectMake(0, 64 + 20 + aboutView.frame.size.height, SCREEN_WIDTH, 40)];
    versionView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:versionView];
    
    UILabel * leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 100, 40)];
    leftLabel.text = @"版本号";
    [versionView addSubview:leftLabel];
    
    UILabel * versionLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH - 110, 0, 100, 40)];
    versionLabel.text = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];;
    versionLabel.textAlignment = NSTextAlignmentRight;
    versionLabel.textColor = [UIColor grayColor];
    [versionView addSubview:versionLabel];
    
}
#pragma mark ------------创建导航栏
-(void)createTheNavigationBar
{
    [[UIApplication sharedApplication]setStatusBarHidden:FALSE];
    [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent];
    
    UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(0.0f, 0.0f, SCREEN_WIDTH, 64.0f)];
    topView.backgroundColor = [UIColor hexStringToColor:COLOR_VALUE];
    [self.view addSubview:topView];
    //标题
    UILabel *titleLab = [[UILabel alloc]initWithFrame:CGRectMake(0.0f, 20.0f, SCREEN_WIDTH, 44.0f)];
    titleLab.backgroundColor = [UIColor clearColor];
    titleLab.font = [UIFont boldSystemFontOfSize:20.0f];
    titleLab.textColor = [UIColor whiteColor];
    titleLab.text = @"关于我们";
    titleLab.textAlignment = NSTextAlignmentCenter;
    [topView addSubview:titleLab];
    
    //返回按钮
    UIButton *backBtn = [[UIButton alloc]initWithFrame:CGRectMake(0.0f, 20.0f, 64.0f, 44.0f)];
    [backBtn setBackgroundImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [backBtn addTarget:self action:@selector(buttonBackTapped:) forControlEvents:UIControlEventTouchUpInside];
    [topView addSubview:backBtn];
    
}
#pragma mark-返回方法
-(void)buttonBackTapped:(id)sender
{
    [self.navigationController popViewControllerAnimated:TRUE];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
